from pathlib import Path
from pydub import AudioSegment

audio_path = Path(__file__).parent / "range函数.m4a"
# 读取音频文件
audio = AudioSegment.from_file(audio_path, format="m4a")

print(f"时长: {len(audio)} 毫秒")
print(f"帧率: {audio.frame_rate} Hz")
print(f"声道数: {audio.channels}")
print(f"样本宽度: {audio.sample_width} 字节")

# 转换为numpy数组
samples = audio.get_array_of_samples()
print(f"样本数: {len(samples)}")
